package com.hxs.colorfultest2.config;

import com.hxs.colorfultest2.component.MyLocaleResolver;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/login").setViewName("login");
        registry.addViewController("/test").setViewName("test");
        registry.addViewController("/mylogin").setViewName("success");

        registry.addViewController("/success").setViewName("success");

        registry.addViewController("/index").setViewName("main");
        registry.addViewController("").setViewName("main");
        registry.addViewController("/userInfo").setViewName("userInfo");
        registry.addViewController("/permission").setViewName("userInfo");

        registry.addViewController("/user.html").setViewName("user");
        registry.addViewController("/addUser").setViewName("addUser");
        registry.addViewController("/addUser.html").setViewName("addUser");
        registry.addViewController("/updateUser").setViewName("updateUser");
        registry.addViewController("/updateUser.html").setViewName("updateUser");

        registry.addViewController("/factory").setViewName("factory");
        registry.addViewController("/addFactory").setViewName("addFactory");
        registry.addViewController("/addFactory.html").setViewName("addFactory");
        registry.addViewController("/updateFactory").setViewName("updateFactory");
        registry.addViewController("/updateFactory.html").setViewName("updateFactory");

        registry.addViewController("/theme").setViewName("theme");
        registry.addViewController("/addTheme").setViewName("addTheme");

        registry.addViewController("/leftSideBar").setViewName("leftSideBar");
        registry.addViewController("/headBar").setViewName("headBar");






    }

    @Bean
    public LocaleResolver localeResolver() {
        return new MyLocaleResolver();
    }
}